count number of smaller elements on right side